package edu.psu.collegerecommendationhelper.algorithm;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import edu.psu.collegerecommendationhelper.model.DemographicInfo;
import edu.psu.collegerecommendationhelper.model.EducationInfo;
import edu.psu.collegerecommendationhelper.model.PreferenceInfo;


import weka.core.Instances;
import weka.core.neighboursearch.NearestNeighbourSearch;

public class WekaToolUtilityTest {
	WekaToolUtility wtu = null;
	UserToClassifierTranslator xlate = null;
	
	@Before
	public void setUp() throws Exception {
		wtu = new WekaToolUtility();
		xlate = new UserToClassifierTranslator();
	}

	@Test
	public void testGenerateModelAlgorithm() {
		NearestNeighbourSearch algorithm = null;
		
		algorithm = wtu.generateModelAlgorithm();
		
		assertNotNull("no algorithm", algorithm);		
	}

	@Test
	public void testEvaluateTestData() {
		
		//UserToClassifierTranslator xlate = new UserToClassifierTranslator();
		
		DemographicInfo demogrInfo = new DemographicInfo();
		EducationInfo edu = new EducationInfo();
		PreferenceInfo pref = new PreferenceInfo();
		
		demogrInfo.setState("NJ");
		demogrInfo.setRace("white");
		
		edu.setGPA((float) 3.0);
		edu.setCreadSAT((short) 600);
		
		pref.setPubpri("public");
		pref.setSize("1000");
		pref.setLocation("new jersey");
		
		ClassifierData classData = xlate.translateData(demogrInfo, edu, pref);
		
		Instances test = xlate.createTestInstances(classData);
		
		System.out.println(test);
		
		boolean rslt = false;
		try {
			rslt = wtu.evaluateTestData(test);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		assertEquals("not true", true, rslt);
	}


}
